#ifndef HASHACTIVITYHANDLER_H_JM_20130322
#define HASHACTIVITYHANDLER_H_JM_20130322

#include "../DbOperationVersion.h"

namespace jm4bbx {

	template<typename HashBoxType>
	class  HashActivityHandler {
	public:
	
		typedef typename HashBoxType::transferValueType TransferValueType;
		typedef typename HashBoxType::HTH::ExtendedHashEntry ExtendedHashEntry;

		typedef BufferedOneOutputBox<BinaryOperationResultIndexType> OutBoxType;

		HashActivityHandler(OutBoxType* b, const BoxParamPack& p) 
			: box_(b), version_(p) { }

		virtual ~HashActivityHandler() { }

		/**
		* Spracovanie jedneho zaznamu nezaheshovanej relacie, ktory ma nenulovy 
		* vyskyt v hashovacej tabulke zaheshovanej relacie.
		* @param value nezaheshovany zaznam
		* @param entry zaheshovany zaznam ((kluc, zaznam), nasobnost)
		**/
		virtual void handleRecord(TransferValueType value, 
			ExtendedHashEntry& entry) = 0; 

		/**
		* Spracovanie jedneho zaznamu nezaheshovanej relacie, ktory ma nulovy 
		* vyskyt v hashovacej tabulke zaheshovanej relacie.
		* @param value hodnota zodpovedajuca nenajdenemu zaznamu
		**/
		virtual void handleNoRecord(TransferValueType value) = 0; 

	protected:
		OutBoxType* box_;
		const DbOperationVersion version_;

		void addOutputData(const BinaryOperationResultIndexType& result) {
			box_->addOutputData(result);
		}
			
	};

} // namespace jm4bbx


#endif
